package com.base.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.base.mapper.PatientinfoBaseMapper;
import com.base.service.PatientinfoBaseService;
import com.base.vo.PageVo;
import com.base.vo.PatientinfoBase;
import org.springframework.stereotype.Service;

/**
 *
 */
@Service
public class PatientinfoBaseServiceImpl extends ServiceImpl<PatientinfoBaseMapper, PatientinfoBase>
        implements PatientinfoBaseService {

    /**
     * 分页条件查询患者列表
     *
     * @param patientinfoBase
     * @param pageVo
     * @return
     */
    @Override
    public Page getList(PatientinfoBase patientinfoBase, PageVo pageVo) {
        Wrapper<PatientinfoBase> queryWrapper = new QueryWrapper<>(patientinfoBase);
        System.out.println(queryWrapper.getSqlSegment());
        Page page = this.baseMapper.selectPage(new Page(pageVo.getPageIndex(), pageVo.getPageSize()), queryWrapper);
        return page;
    }

    @Override
    public Page getMergeList(PatientinfoBase patientinfoBase, PageVo pageVo) {
        QueryWrapper<PatientinfoBase> queryWrapper = new QueryWrapper<>(patientinfoBase);
        queryWrapper.eq(patientinfoBase.getIssame()==1,"RelType","1");
        queryWrapper.eq(patientinfoBase.getIsseem()==1,"RelType","2");
        Page page = this.baseMapper.selectMergePageVo(new Page(pageVo.getPageIndex(), pageVo.getPageSize()), queryWrapper);
        return page;
    }
}




